//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CSpriteBitmap.h>
///	@path	~/src/gui/image/
///	@date	2008/06/28
///	@desc	.

#pragma once

#include "xeres.h"

#include <vector>

#include "gui/composite/layer.h"
#include "gui/image/CColorBitmap.h"

namespace xeres {

	/*! 
		\class	CSpriteBitmap
		\brief
	*/
	class CSpriteBitmap : public CColorBitmap
	{
	public:

		/// \ctor
		CSpriteBitmap( size_t width , size_t height , ColorType type , int frames , const byte * src );

		/// \ctor
		CSpriteBitmap( const std::vector<Gdiplus::Bitmap *>& frames );

		/// \dtor
		virtual ~CSpriteBitmap( void );

		DECL_IOBJECT_CLASS( CSpriteBitmap , CColorBitmap );

	public:

		/// \name	Bitmap Interface
		//@{

		/// \brief	Get frame count.
		virtual int GetFrame( void );

		/// \brief	Get frame delay.
		virtual float GetDelay( int frame );

		/// \brief	Get storage size.
		virtual size_t GetStorageSize( void );

		/// \brief	Get pixel of bitmap.
		virtual RGBA GetPixel( const Pair<int>& point , int frame = 0 );

		/// \brief	Get sampler.
		virtual void GetSampler( const Pair<int>& point , Sampler& sampler , int frame = 0 );

		//@}

	private:

		//@ data
		int					m_frameCount;
	};

	/*! 
		\class	CGifBitmap
		\brief
	*/
	class CGifBitmap : public CColorBitmap
	{
	public:
		
		/// \ctor
		CGifBitmap( Gdiplus::Bitmap& gif );

		/// \dtor
		virtual ~CGifBitmap( void );

		DECL_IOBJECT_CLASS( CGifBitmap , CColorBitmap );

	public:

		/// \name	Bitmap Interface
		//@{

		/// \brief	Get frame count.
		virtual int GetFrame( void );

		/// \brief	Get frame delay.
		virtual float GetDelay( int frame );

		/// \brief	Get storage size.
		virtual size_t GetStorageSize( void );

		/// \brief	Get pixel of bitmap.
		virtual RGBA GetPixel( const Pair<int>& point , int frame = 0 );

		/// \brief	Get sampler.
		virtual void GetSampler( const Pair<int>& point , Sampler& sampler , int frame = 0 );

		//@}

	private:

		//@ data
		std::vector<float>	m_delay;
	};

} // namespace xeres
